package com.wanganui.douyin.service;

import lombok.RequiredArgsConstructor;
import org.skyer.douyin.config.AgentConfiguration;
import org.skyer.douyin.config.DyConfiguration;

import java.util.Objects;

/**
 * @author xtwang
 * @des 抖音应用配置服务（可配置多个应用）
 * @date 2025/3/15 上午11:04
 */
@RequiredArgsConstructor
public class AgentConfigService {
    private final DyConfiguration dyConfiguration;

    /**
     * 根据应用key获取应用信息
     *
     * @param clientKey 应用key
     */
    public AgentConfiguration loadAgentByTenantId(String clientKey) throws RuntimeException {
        AgentConfiguration agentConfiguration = dyConfiguration.getAgentByClientKey(clientKey);
        if (Objects.isNull(agentConfiguration)) {
            throw new RuntimeException("未配置应用信息");
        }
        return agentConfiguration;
    }

}
